help(hist) 
## starting httpd help server ... done
help(log) 

Basic R Commands

x <- c(2,4,5,7)
x
## [1] 2 4 5 7
x = c(2,4,5,7)  
x
## [1] 2 4 5 7

Let us consider the thickness measurements on the tabs used to close 5-gallon paint cans (n = 135, measured in microns). We enter the data into the object “thick”.

thick = c(29,36,39,34,34,29,29,28,32,31,34,34,39,38,37,
35,37,33,38,41,30,29,31,38,29,34,31,37,39,36,
30,35,33,40,36,28,28,31,34,30,32,36,38,38,35,
35,30,37,35,31,35,30,35,38,35,38,34,35,35,31,
34,35,33,30,34,40,35,34,33,35,34,35,38,35,30,
35,30,35,29,37,40,31,38,35,31,35,36,30,33,32,
35,34,35,30,36,35,35,31,38,36,32,36,36,32,36,
36,37,32,34,34,29,34,33,37,35,36,36,35,37,37,
36,30,35,33,31,35,30,29,38,35,35,36,30,34,36)

Prints out data

thick
##   [1] 29 36 39 34 34 29 29 28 32 31 34 34 39 38 37 35 37 33 38 41 30 29 31 38 29
##  [26] 34 31 37 39 36 30 35 33 40 36 28 28 31 34 30 32 36 38 38 35 35 30 37 35 31
##  [51] 35 30 35 38 35 38 34 35 35 31 34 35 33 30 34 40 35 34 33 35 34 35 38 35 30
##  [76] 35 30 35 29 37 40 31 38 35 31 35 36 30 33 32 35 34 35 30 36 35 35 31 38 36
## [101] 32 36 36 32 36 36 37 32 34 34 29 34 33 37 35 36 36 35 37 37 36 30 35 33 31
## [126] 35 30 29 38 35 35 36 30 34 36
print(thick) 
##   [1] 29 36 39 34 34 29 29 28 32 31 34 34 39 38 37 35 37 33 38 41 30 29 31 38 29
##  [26] 34 31 37 39 36 30 35 33 40 36 28 28 31 34 30 32 36 38 38 35 35 30 37 35 31
##  [51] 35 30 35 38 35 38 34 35 35 31 34 35 33 30 34 40 35 34 33 35 34 35 38 35 30
##  [76] 35 30 35 29 37 40 31 38 35 31 35 36 30 33 32 35 34 35 30 36 35 35 31 38 36
## [101] 32 36 36 32 36 36 37 32 34 34 29 34 33 37 35 36 36 35 37 37 36 30 35 33 31
## [126] 35 30 29 38 35 35 36 30 34 36
thick[12]                           #is the 12th observation in the list.
## [1] 34
thickordered = order(thick)   #orders the data set from smallest to the largest. 
thickordered
##   [1]   8  36  37   1   6   7  22  25  79 111 128  21  31  40  47  52  64  75
##  [19]  77  88  94 122 127 133  10  23  27  38  50  60  82  85  98 125   9  41
##  [37]  90 101 104 108  18  33  63  69  89 113 124   4   5  11  12  26  39  57
##  [55]  61  65  68  71  92 109 110 112 134  16  32  45  46  49  51  53  55  58
##  [73]  59  62  67  70  72  74  76  78  84  86  91  93  96  97 115 118 123 126
##  [91] 130 131   2  30  35  42  87  95 100 102 103 105 106 116 117 121 132 135
## [109]  15  17  28  48  80 107 114 119 120  14  19  24  43  44  54  56  73  83
## [127]  99 129   3  13  29  34  66  81  20
thickordered[12]                    #is the observation with rank 12
## [1] 21

various operations

summary(thick)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    28.0    31.5    35.0    34.1    36.0    41.0
#calculates summary statistics (min, first quartile, median, mean, third quartile, max)
quantile(thick, probs = c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9))
##  10%  20%  30%  40%  50%  60%  70%  80%  90% 
## 30.0 31.0 33.0 34.0 35.0 35.0 36.0 36.2 38.0
#calculates the percentiles of order 0.1, 0.2, …, 0.9

These following commands calculate and store in the object to the left of the equality, the mean, median, standard deviation, and variance of the 135 observations.

a1 = mean(thick)
a2 = median(thick)
a3 = sd(thick)
a4 = var(thick) 
a4   #prints out the variance 
## [1] 9.087673
boxplot(thick)  #creates the box and whisker diagram

hist(thick)

#creates the histogram
#for further options, look at the help command for hist
#install.packages("BHH2")
library(BHH2)
dotPlot(thick)   #creates the dotplot. 

#Note that the package BHH2 is needed.
#comment the installation code after use, only need to install #packages once however need to load packages 

Entering data and text into an R-session

Let us consider the data weight (in 1000 pounds) and the fuel efficiency (in gallons per 100 miles) of n = 10 cars listed below (see Abraham and Ledolter (2006)). The third column represents the name of the car.

reading in data

You can enter the data by reading in each variable individually:

ygpm = c(5.5,5.9,6.5,3.3,3.6,4.6,2.9,3.6,3.1,4.9)           #gallons per 100 miles
xweight = c(3.4,3.8,4.1,2.2,2.6,2.9,2.0,2.7,1.9,3.4)        #weight in 1000 pounds
ygpm            #prints out ygpm
##  [1] 5.5 5.9 6.5 3.3 3.6 4.6 2.9 3.6 3.1 4.9
xweight     #prints out xweight
##  [1] 3.4 3.8 4.1 2.2 2.6 2.9 2.0 2.7 1.9 3.4

can also read the data from external text files: - read in a csv file

data = read.csv("C:\\Johannes Ledolter\\2020March01Book\\AppendixWEB\\FuelEfficiency.csv") 
data
  • read in a Notepad file
hook = read.table("C:\\Johannes Ledolter\\2020March01Book\\AppendixWEB\\hooker.txt", header = T)

more commands for hook dataset

data transformation

Temp = hook[,1]    #define the first column of the matrix “hook” as Temp (the boiling temperature of water) 
Temp
##  [1] 210.8 210.2 208.4 202.5 200.6 200.1 199.5 197.0 196.4 196.3 195.6 193.4
## [13] 193.6 191.4 191.1 190.6 189.5 188.8 188.5 185.7 186.0 185.6 184.1 184.6
## [25] 184.1 183.2 182.4 181.9 181.9 181.0 180.6
AP = hook[,2]      #and the second column as AP (the atmospheric pressure)
AP
##  [1] 29.211 28.559 27.972 24.697 23.726 23.369 23.030 21.892 21.928 21.654
## [11] 21.605 20.480 20.212 19.758 19.490 19.386 18.869 18.356 18.507 17.267
## [21] 17.221 17.062 16.959 16.881 16.817 16.385 16.235 16.106 15.928 15.919
## [31] 15.376
LnAP = 100*log(AP) #transforming the variable AP; log(AP) is the natural log of AP

linear regression

hookfit = lm(Temp ~ LnAP) # fitting a linear regression
summary(hookfit)          # a comprehensive summary of the results of the regression analysis
## 
## Call:
## lm(formula = Temp ~ LnAP)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.61082 -0.25933 -0.08886  0.22432  0.67772 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 49.268403   1.198964   41.09   <2e-16 ***
## LnAP         0.478184   0.004016  119.08   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4016 on 29 degrees of freedom
## Multiple R-squared:  0.998,  Adjusted R-squared:  0.9979 
## F-statistic: 1.418e+04 on 1 and 29 DF,  p-value: < 2.2e-16
anova(hookfit)            # the analysis of variance (ANOVA) table 

plots

plot(LnAP, Temp)          # plots Temp (the y-coordinate) against LnAP (the x-coordinate). 
abline(hookfit)           # a fitted line added to the plot 

qqnorm(hookfit$residuals) # normal probability plot of the residuals

fitting a multiple linear regression on made-up data

x1 = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) 
x2 = c(5, 6, 7, 8, 8, 6, 3, 2, 4, 5)
x3 = c(9, 10, 11, 12, 20, 32, 44, 21, 43, 65)
y = c(2, 4, 6, 8, 7 , 8, 4, 6, 11, 12)
mregfit = lm(y ~ x1 + x2 + x3)  # with intercept
summary(mregfit)
## 
## Call:
## lm(formula = y ~ x1 + x2 + x3)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.0790 -0.1809  0.3401  0.5797  1.6888 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept) -4.643927   2.206491  -2.105   0.0800 .
## x1           1.121667   0.332734   3.371   0.0150 *
## x2           0.986840   0.271128   3.640   0.0108 *
## x3          -0.002029   0.050491  -0.040   0.9692  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.402 on 6 degrees of freedom
## Multiple R-squared:  0.8653, Adjusted R-squared:  0.798 
## F-statistic: 12.85 on 3 and 6 DF,  p-value: 0.005066
mulregfit = lm(y ~ x1 + x2 + x3 - 1)  # without intercept 
summary(mulregfit)
## 
## Call:
## lm(formula = y ~ x1 + x2 + x3 - 1)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.1813 -1.0643 -0.0848  0.8866  1.8685 
## 
## Coefficients:
##    Estimate Std. Error t value Pr(>|t|)  
## x1  0.74415    0.34208   2.175   0.0661 .
## x2  0.47434    0.14553   3.259   0.0139 *
## x3  0.01248    0.06105   0.204   0.8438  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.712 on 7 degrees of freedom
## Multiple R-squared:  0.9627, Adjusted R-squared:  0.9467 
## F-statistic: 60.25 on 3 and 7 DF,  p-value: 2.296e-05

Useful R commands for textual data analytics

string

mytext = "the weather of today is nice"   # string object mytext is created with double quotes
mytext
## [1] "the weather of today is nice"
mytext = 'the weather of today is nice'   # string object mytext is created using simple quotes
mytext
## [1] "the weather of today is nice"
mytext = "the weather of TODAY is nice"
nchar(mytext)         # count the number of characters
## [1] 28
toupper(mytext)     # change all the characters of the string to upper case
## [1] "THE WEATHER OF TODAY IS NICE"
tolower(mytext)     # change all the characters of the string to lower case
## [1] "the weather of today is nice"

a vector of strings

myvector = c("the weather of today is nice", "Today is a good day")       
myvector   # creates the vector myvector with two elements; each element contains a string
## [1] "the weather of today is nice" "Today is a good day"
nchar(myvector)     # returns the number of characters of each string in the vector
## [1] 28 19
length(myvector)    # the number of elements (strings) in the vector
## [1] 2
mytext = paste("the weather", "of today", "is nice")        # paste the three strings into one string and separate strings by a space
mytext
## [1] "the weather of today is nice"
length(mytext)
## [1] 1
mytext = paste("the weather", "of today", "is nice", sep = ",")    # paste the three strings into one and separate strings by “,”
mytext
## [1] "the weather,of today,is nice"
length(mytext)
## [1] 1
myvector = c("the weather", "of today", "is nice")      # creates a vector containing three strings
myvector
## [1] "the weather" "of today"    "is nice"
mytext = paste(myvector, collapse = " ")       # the three strings in the vector are pasted into one and separated by a space
mytext
## [1] "the weather of today is nice"
length(mytext)
## [1] 1
mytext = "the weather of today is nice"
substr = substring(mytext, 3, 8)        # extract a sub-string from the 3rd to 8th character
substr
## [1] "e weat"
myvector = c("The WEATHER", "the weather", "THE WEather")       
grep("EA", myvector)             # find the strings that contain “EA”
## [1] 1
grep("EA", myvector, ignore.case = TRUE)   # since grep is case sensitive, use ignore.case = TRUE.
## [1] 1 2 3
grep("EA", myvector, value = TRUE)   # use the argument value=TRUE to return the strings
## [1] "The WEATHER"
myvector = c("the weather of today is NICE", "it is nice")
myvecrepl = gsub("nice", "good", myvector)    # replace “nice” with “good”, the “NICE” is not replaced
myvecrepl
## [1] "the weather of today is NICE" "it is good"
myvecrepl = gsub("nice", "good", ignore.case = TRUE, myvector)   # both “NICE” and “nice” are replaced  
myvecrepl
## [1] "the weather of today is good" "it is good"
myvector = c("the weather of today is nice", "it is nice")
strsplit(myvector, " ")         # split the strings by a space " "
## [[1]]
## [1] "the"     "weather" "of"      "today"   "is"      "nice"   
## 
## [[2]]
## [1] "it"   "is"   "nice"
# strsplit returns a list. If we want a character vector, combine the list 

unlist(strsplit(myvector, " "))
## [1] "the"     "weather" "of"      "today"   "is"      "nice"    "it"     
## [8] "is"      "nice"

Useful R commands for reading text data from files

csv

data = read.csv("C:\\Johannes Ledolter\\2020March01Book\\Chapter1WEB\\test.csv", header = FALSE, stringsAsFactors = FALSE)
dim(data)
## [1] 4 1
data[,1]
## [1] "Mr. STEVENS. The gentleman cannot have anything to explain. As he has not spoken there is nothing to explain, nothing to patch up."                                                                                                                                                                                                                                                                                                                                
## [2] "Mr. BROOKS. I do not see the relevancy of that remark. I desire to know, Mr. Clerk, first, whether I can yield the floor temporarily to the gentleman from Pennsylvania for the purpose of explanation; or second, whether I can yield the remaining portion of my time to him."                                                                                                                                                                                   
## [3] "The CLERK. Under the rules of the House the gentleman from New York cannot yield the remaining portion of his time to any member if objection is made to his doing so; nor can he yield to any other member, except for purposes of personal explanation in relation to the pending proposition. The gentleman from Pennsylvania has stated that he did not rise for the purpose of explanation. Hence by his own statement he is precluded from taking the floor."
## [4] "Mr. JOHNSON. I do not desire the floor for the purpose of personal explanation, but I desire to as an explanation of the gentleman from New York."
str(data)         # shows the class of each column
## 'data.frame':    4 obs. of  1 variable:
##  $ V1: chr  "Mr. STEVENS. The gentleman cannot have anything to explain. As he has not spoken there is nothing to explain, n"| __truncated__ "Mr. BROOKS. I do not see the relevancy of that remark. I desire to know, Mr. Clerk, first, whether I can yield "| __truncated__ "The CLERK. Under the rules of the House the gentleman from New York cannot yield the remaining portion of his t"| __truncated__ "Mr. JOHNSON. I do not desire the floor for the purpose of personal explanation, but I desire to as an explanati"| __truncated__
dim(data)         # shows the dimension of the data frame
## [1] 4 1
nrow(data)      # number of rows
## [1] 4
ncol(data)      # number of columns 
## [1] 1
summary(data)   # shows the statistical summary
##       V1           
##  Length:4          
##  Class :character  
##  Mode  :character

txt file

data = readLines("C:\\Johannes Ledolter\\2020March01Book\\AppendixWEB\\combine39.txt")
class(data)       # examine the class of mytext
## [1] "character"
length(data)        # the number of elements in the vector
## [1] 106346
data[1:3]
## [1] "@@@IN SENATE SENATE. MONDAY, December 4, 1866. This being the day prescribed the constitution of the U.S. for the meeting of Congress, the Senate assembled in the senate Chamber, in the Capitol, at the city of Washington. The following Senators were present. From the State of Haine Hon. William Pitt Fessenden and Hon. Lot M. Morrill. lV of Hampshire Hon. Danief elark. Vermont Hon. Solomon Foot. Massachusetts Hon. Charles Sumner and Hon. Henry Wilson. RhdIsland Hon. Henry B. Anthony and Hon. William Sprague. Connecticut on. James Dixon and Hon. LaFayette 8. Foster. NewYork Hon. Ira Harris and Hon. edwin D. Morgan. NewJersey Hon. William Wright. Pennsylvania Hon. Charles Mr. Buckalew and Hon. edr Cowan. Delaware on. George Read Riddle and Hon. Willard Man Saulsbu. Lend Hon. J J. Creswell and Hon. Reverdy Johnson. Acntucln Hon. James Guthrie. Ohzrr John Sherman and Heathen jamin F. Wade. Indiana Hon. Henry S. Lane. Hline isHon. Lyman Trumbull. Kisxburi Hon. B. Gratz Brown. Michigan Hon. Zachariah Chandler and Hon. Jacob M. Howard. IVzaemmn Hon. James Mr. Doolittle and Hon. Timothy o. Howe. [mowHon. James W. Grimes. California Hon. John Conness and Hon. James A. McDougall. Minnesota Hon. Daniel S. Norton and Hon. Alexander Ramse. OregonHon. James W. Nesmith and Hon. George H. Williams. KansasHon. Samuel C. Pomeroy. WestVirginia Hon. Peter G. Van Winkle and Hon. Waitmsn T. Willey. Asvada Hon. James W. Nye and Hen. Yilliam M. Stewart. The President Protempore[Hon LAFarms S. FOSTER] at 12 oclock called the Senate to order. PRAYBR. "                                                                                                                                                                                                                                                                                                                                                                        
## [2] "Rev. EDGAR H GRAY, the Chaplain to the Senate for the 39th Congress, offered the following prayer: Glory be to Thy name, o God, that the republic still lives, the nation survives, the country is safe! Glory be to Thy name the our heroic efforts have been crowned with victory so that the desolations of war have ceased, and the ground no longer shakes beneath the tread of armies Glory he to Thy name that we are permitted to recognize God in the dispensations of His providence and His grace in dealing with us. We praise Thee with thanksgiving that the statue of Freedom now looks down from our Capitol upon an entire nation of free men, and that we are permitted by the dispensations of Thy provience, and the way being prepared, to give liberty to the captive, the opening of the prison to them that are bound, and to reclaim the acceptable year of our God. o Lord, we bless Thee that Thy servants are permitted to convene in these halls of legislation under circumstances so auspicious to deliberate upon matters grave an important to the interests of the nation. Grant, we pray Thee, that all their deliberations and enactments may be such as to secure the divine approval, and insure the unanimous acquiescence of our people, and command the respect of the nations of the earth. o Lord, grant that the afflictive dispensations of Thy providence, and the public bereavements which the nation and the Senate have suffered since the last convened, may be preeminently sanct edto our good and bless, We pray Thee, our president and the ministers of State associated with him in authority, and endue them richly with wisdom and strength adequate to their great responsibilities and grant that the principles of our free and glorious Government may be established upon an everlasting basis, and come, Thou Ancient of days, and reign over us forever. Amen. The President Protempore took the chair. CREDENTIALS."
## [3] "Mr. FOOT. Mr. President, I present the credentials of Hon. LUKE PPOLAND, appointed by the Executive of the State of Vermont, to fill the vacancy which recently occurred in the representation from that State in this body. I move that the credentials be read, the prescribed oaths administered to Mr. POLAND by the Chair, and that he be admitted to his seat. The credentials were read, and the oaths prescribed by law having been administered to Mr. POLAND, he took his seat in the Senate. "

two ways of writing the string vector “mytext” into a file

writeLines("The weather of today is nice", "C:\\Johannes Ledolter\\2020March01Book\\AppendixWEB\\mytext.txt")
mytext = "The weather of today is good"
#writeLines(mytext, "C:\\Johannes Ledolter\\2020March01Book\\AppendixWEB\\mytext.txt")

XML

library(XML)
root = xmlParse("C:\\Johannes Ledolter\\2020March01Book\\AppendixWEB\\23.xml") 
year = xpathSApply(root, "//year", xmlValue, recursive = FALSE)       # year letter written  
year[1:3]
## [1] "1781" "1784" "1785"
aut = xpathSApply(root, "//from", xmlValue, recursive = FALSE)        # author of letter
aut[1:3]
## [1] "State of New York"      "State of Virginia"      "State of Massachusetts"
rec = xpathSApply(root, "//to", xmlValue, recursive = FALSE)              # recipient of letter
rec[1:3]
## [1] "the World" "the World" "the World"
header = xpathSApply(root, "//header", xmlValue, recursive = FALSE) # header of letter
header[1:3]
## [1] " to [LC: CC Papers, West. Land Cessions: DS 1]\n\t\t\t[March 1, 1781]"    
## [2] " to [LC: CC Papers, West. Land Cessions: DS 9]\n\t\t\t[March 1, 1784]\n\t\t"
## [3] " to [LC: CC Papers, West. Land Cessions: DS 22]\n\t\t\t[April 19, 1785]"
text = xpathSApply(root, "//record/body", xmlValue, recursive = FALSE)  # text of letter
text[1:3]
## [1] "\n\t\t\tNew_York: CESSION OF WESTERN LAND CLAIMS To all People who shall see these presents, We James_Duane, William_Floyd and Alexander McDougall the underwritten Delegates for the State of New_York in the honorable Congress of the United_States of America send Greeting. Whereas by an Act of the Legislature of the said Stafe of New_York passed at a Session held at Albany in the Year of our Lord 1780, entitled An Act to facilitate the Completion of the Articles of Confederation and perpetual Union among the United_States of America 2 it is declared that the People of the State of New_York were on all Occasions disposed to manifest their Regard for their Sister States, and their earnest desire to promote the General Interest and Security, and more especially to accelerate the federal Alliance, by removing as far as it depended upon them the Impediment to it's final Accomplishment respecting the Waste and uncultivated Lands within the Limits of Certain States: And it is therfore thereby enacted by the People of the said State of New_York represented in Senate and Assembly, and by the Authority of the same, that it should and might be lawful to and for the Delegates of the said State in the honorable Congress, And they or the major part of them so assembled are thereby fully authorized and empowered for and on Behalf of that State, and by proper and authentic Acts or Instruments to limit and restrict the Boundaries of the said State in such Manner and form as they shall judge to be expedient either with respect to the Jurisdiction as well as the Right or Pre-emption of Soil; or Reserving the Jurisdiction in part or in the whole over the Lands which may be ceded, or relinquished with respect only to the Right of Pre-emption of the Soil: \n\t\t\tAnd by the said Act it is further enacted, that the Territory which may be ceded or relinquished by Virtue thereof either with respect to the Jurisdiction as well as the Right or pre-emption of Soil, or the Right or Pre-emption of Soil only, shall be and enure for the Use and Benefit of such of the United_States as shall become Members of the fcederal Alliance of the said States, and for no other Use or purpose whatsoever. And by the said Act it is provided and enacted that the Trust reposed by virtue thereof shall not be executed by the Delegates of the said State unless at least three of the said Delegates shall be present in Congress. And Whereas by Letters patent under the great Seal of the said State of New_York bearing date the Twenty ninth day of October last past, Reciting, that the Senate and Assembly had on the twelfth day of September then last past nominated and appointed us the said James_Duane, William_Floyd and Alexander McDougall, together with John_Morin Scott and Ezre  L'Hommedieu Delegates to represent the said State in the Congress of the United_States of North America. Therefore in Pursuance of the said Nomination and Appointment, The People of the said State of New_York did thereby commission us the said James_Duane, William_Floyd and Alexander McDougall and the said John_Morin Scott and Ezre L'Hommedieu or any Majority who should from time to time attend the said Congress, And if only one of the said Delegates should at any time be present in the said Congress he should in such case be authorized to represent the said State in the said Congress, As by an authentic Copy of the said Act and an Exemplification of the said Commission remaining among the Archives of Congress fully appears. Now 4 therefore know ye that We the said James_Duane, William_Floyd and Alexander McDougall, by Virtue of the Power and Authority, and in the Execution of the Trust reposed in us as aforesaid, have judged it expedient to limit and restrict, \n\t\t\tAnd we do by these Presents, for and On Behalf of the said State of New_York, limit and restrict the Boundaries of the said State in the western parts thereof, with respect to the Jurisdiction as well as the Right or Pre-emption of Soil, by the Lines and in the form following, 5 that is to say, A Line from the Northeast Corner of the State of Pennsylvania along the North Bounds thereof to it's North west Corner continued due West until it shall be intersected by a meridian Line to be drawn from the forty fifth Degree of North Latitude through the most westerly Bent or Inclination of Lake Ontario, Thence by the said meridian Line to the forty fifth Degree of North Latitude, and thence by the said forty fifth Degree of North Latitude. But if on Experiment the above described meridian Line shall not comprehend Twenty Miles due West from the most westerly Bent or Inclination of the River or Strait of Niagara, Then we do by these presents in the. Name of the people and for and on Behalf of the State of New_York, and by Virtue of the Authority aforesaid, limit and restrict the Boundaries of the said State in the western parts thereof with respect to Jurisdiction as well as the Right or Pre-emption of Soil by the Lines and in the Manner following, that is to say.\n\t\t\t-A Line from the North East Corner of the State of Pennsylvania along the North Bounds thereof to it's North West Corner continued due West until it shall be intersected by a meridian Line to be drawn from the 45th degree of North Latitude through a point twenty Miles due West from the most westerly Bent or Inclination of the River or Strait of Niagara, Thence by the said meridian Line to the forty fifth degree of North Latitude, and thence by the said forty fifth Degree of North Latitude. And we do by these presents, in the Name of the People and for and on Behalf of the State of New_York and by Virtue of the Power and Trust committed to us by the said Act and Commission, cede, transfer and for ever relinquish to and for the only Use and Benefit of such of the States as are or shall become Parties to the Articles of Confederation, All the Right, Title, Interest, Jurisdiction and Claim of the said State of New_York to all Lands and Territories to the Northward and Westward of the Boundaries to which the said State is in Manner aforesaid limited and restricted, And to be granted, disposed of and appropriated in such Manner only as the Congress of the said United or confederated States shall order and direct.\" In Testimony whereof we have hereunto subscribed our Names and affixed our Seals in Congress the first day of March in the Year of our Lord 1781, And of our Independence the fifth.\n\t\t\tSealed and delivered JA DUANE \n\t\t\tin presence of William_FLOYD \n\t\t\tCha Thomson ALEX: McDOUGALL \n\t\t\tCha: Morse\n\t\t\tEbenezer Smith\n\t\t\t[Endorsed] New_York Cession of Western Territory Executed by the Delegates from that State March 1\" 1781.--Recorded page 1.\n\t\t"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
## [2] "\n\t\t\tVIRGINIA: CESSION OF WESTERN LAND CLAIMS To all who shall see these presents\n\t\t\tWe Thomas_Jefferson, Samuel_Hardy, Arthur Lee and James_Monroe the underwritten, delegates for the Commonwealth in Virginia in the Congress of the United_States of America send Greeting Whereas the General Assembly of the Commonwealth of Virginia at their sessions begun on the twentieth day of October 1783 passed an Act entitled \"an Act to authorize the delegates of this State in Congress to convey to the United_States in Congress Assembled all the right of this Commonwealth\n\t\t\tto the Territory North-Westward of the River_Ohio.\" in these words following to Wit  __\n\t\t\t\"Whereas the Congress of the United_States did by their Act of the sixth day of September in the year 1780 recommend to the several States in the Union having claims to waste and unappropriated Lands in the Western Country a liberal Cession to the United_States of a portion of their respective claims for the common Benefit of the Union. And Whereas this Commonwealth did on the second day of January in the year 1781 yield to the Congress of the United_States for the Benefit of the said States all right, title & claim which the said Commonwealth had to the Territory North-West of the River_Ohio subject to the Conditions annexed to the said Act of Cession And Whereas the United_States in Congress Assembled have by their Act of the thirteenth of September last 13 stipulated the terms on which they agree to accept the Cession of this State should the Legislature approve thereof which Terms although they do not come fully up to the propositions of this Commonwealth are conceived on the whole to approach so nearly to them as to induce this State to accept thereof in full confidence that Congress will in justice to this State for the liberal Cession she hath made earnestly press upon the other States claiming large Tracts of waste and uncultivated Territory the propriety of making Cessions equally liberal for the common Benefit and support of the Union Be it enacted by the General Assembly that it shall and may be lawful for the delegates of this State to the Congress of the United_States or such of them as shall be assembled in Congress and the said delegates or such of them so assembled are hereby fully authorized and empowered for and on behalf of this State by proper deeds or instrument in writing under their Hands and Seals to convey, transfer, assign and make over unto the United_States in Congress Assembled for the Benefit of the said States all right title and claim as well of soil as jurisdiction which this Commonwealth hath to the Territory or Tract of Country within the\n\t\t\tlimits of the Virginia Charter situate lying and being to the NorthWest of the River_Ohio subject to the terms and conditions contained in the before recited Act of Congress of the thirteenth day of September last that is to say upon condition that the Territory so ceded shall be laid out and formed into States containing a suitable extent of Territory not less than 100 nor more than 150 miles square or as near thereto as circumstances will admit and that the States so formed shall be distinct Republican States and admitted members of the fcederal union, having the same rights of Sovereignty, Freedom and Independence as the other States 4--That the necessary and reasonable expences incurred by this State in subduing any British Posts or in maintaing Forts or Garrisons, within and for the defence or in acquiring any part of the Territory so Ceded or relinquished shall be fully reimbursed by the United_States and that one Commissioner shall be appointed by Congress one by this Commonwealth and another by those two Commissioners who or a majority of them shall be authorized and empowered to adjust and liquidate the account of the necessary and reasonable expences incurred by this State which they shall judge to be comprized within the intent and meaning of the Act of Congress of the tenth of October 1780 respecting such expences That the French and Canadian Inhabitants and other Settlers of the Kaskaskies St Vincents and the neighbouring Villages who have professed themselves Citizens of Virginia shall have their possessions and titles confirmed to them and be protected in the enjoyment of their rights and liberties 1 -\n\t\t\tThat a quantity not exceeding 150,000 Acres of Land promised by this State shall be allowed and granted to the then Colonel now General George_Rogers Clarke and to the Officers and Soldiers of his Regiment who marched with him when the posts of Kaskaskies and St Vincents were reduced and to the Officers and Soldiers that have been since incorporated into the said Regiment to be laid off in one Tract the length of which not to exceed double the breadth in such place on the NorthWest Side of the Ohio as a majority of the Officers shall choose and to be afterwards divided among the said Officers and Soldiers in due proportion according to the Laws of Virginia. 7 \n\t\t\tThat in case the quantity of good Lands on the South-East side of the Ohio upon the Waters of Cumberland River and between the Green River and Tenessee river which have been reserved by Law for the Virginia Troops upon Continental establishment should from the North Carolina line bearing in further upon the Cumberland Lands than was expected prove insufficient for their legal Bounties the deficiency should be made up to the said Troops in good Lands to be laid off between the Rivers Scioto & little Miami on the north-West Side of the River_Ohio in such proportions as have been engaged to them by the Laws of Virginia 1--That all the Lands within the Territory so Ceded to the United_States and not reserved for or appropriated to any of the before mentioned purposes or disposed of in bounties to the Officers and Soldiers of the American Army shall be considered as a common fund for the use and benefit of such of the United_States as have become or shall become members of the Confederation or fcederal Alliance of the said States Virginia inclusive according to their usual respective proportions in the general charge and expenditure and shall be faithfully and bona fide disposed of for that purpose and for no other use or purpose whatsoever. Provided that the Trust hereby reposed in the delegates of this State shall not be executed unless three of them at least are present in Congress.\" \n\t\t\tAnd Whereas the said General Assembly by their Resolution of June sixth 1783 had constituted and appointed us the said Thomas_Jefferson, Samuel_Hardy, Arthur Lee and James_Monroe delegates to represent the said Commonwealth in Congress for one year from the first Monday in November then next following, which Resolution remains in full force Now therefore Know Ye that we the said Thomas_Jefferson, Samuel_Hardy, Arthur Lee and James_Monroe by virtue of the power and authority committed to us by the Act of the said General Assembly of Virginia before recited, and in the name & for & on behalf of the said Commonwealth do by these presents convey, transfer, assign and make over unto the United_States in Congress Assembled for the benefit of the said States, Virginia inclusive all right, title and claim as well of soil as of jurisdiction which the said Commonwealth hath to the Territory or tract of Country within the limits of the Virginia Charter, situate, lying and being to the North-West of the River_Ohio, to and for the uses & purposes and on the Conditions of the said recited Act. In Testimony whereof we have hereunto subscribed our Names and affixed our Seals in Congress the first day of March 1 in the year of our Lord 1784 and of the Independence of the United_States the Eighth.\"\n\t\t\tSign'd, Sealed and TH: JEFFERSON  \n\t\t\tDelivered in presence of- S: HARDY  \n\t\t\tCha Thomson ARTHUR LEE  \n\t\t\tHenry_Remsen Jr JA MONROE  \n\t\t\tBenjamin_Bankson Junr 20\n\t\t\t[Endorsed] Virginia Cession of Western Territory executed by Delegates of that State March 1St 1784-Recorded page 7 \n\t\t"
## [3] "\n\t\t\tMASSACHUSETTS: CESSION OF WESTERN LAND CLAIMS To all who shall see these presents, We Samuel_Holten and Rufus_King the under written Delegates for the Commonwealth of Massachusetts in the Congress of the United_States of America send Greeting:\n\t\t\tWhereas the General Court of Massachusetts on the thirteenth day of November in the year of our Lord 1784 passed an Act intitled \"An Act empowering the Delegates of this Commonwealth in the United_States in Congress assembled to relinquish to the United_States certain lands the property of this Commonwealth, in the words following,\n\t\t\t\"Whereas several of the States in the Union have at present no interest in the great and extensive tract of uncultivated country lying in the westerly part of the United_States and it may be reasonable that the States above mentioned should be interested in the aforesaid Country, Be it Enacted by the Senate and House of Representatives in General Court Assembled and by the authority of the same, that the Delegates of this Commonwealth in the United_States in Congress Assembled, or any three of the said Delegates be and they hereby are authorised and empowered for and in behalf of this Commonwealth to Cede or relinquish, by authentic conveyance or conveyances to the United_States to be disposed of, for the common benefit of the same agreeably to a Resolve of Congress of October the tenth 1780, such part of that tract of Land belonging to this Commonwealth which lies between the Rivers Hudson and Mississipi as they may think proper, and to make the said Cession in such manner and on such conditions as shall appear to them to be most suitable.\n\t\t\tAnd whereas the said General Court on the seventeenth day of March in the Year of our Lord 1785 passed one other Act 24 intitled \"An Act in addition to an Act intitled An Act empowering the Delegates of this Commonwealth in the United_States in Congress Assembled to relinquish to the United_States certain Lands the property of this Commonwealth\" in the words following,\n\t\t\t\"Whereas by the Act aforesaid three Delegates representing this State in Congress are necessary to make the Cession aforesaid, and it may be Necessary that the said business should be performed by a less number of the said Delegates, Be it therefore enacted by the Senate and House of Representatives in General Court assembled, and by the authority of the same that any two Delegates, representing this Commonwealth in Congress, be and hereby are authorised and empowered, to do and perform all matters and things which by the Act aforesaid might be done and performed, by any three Delegates as aforesaid any thing in the aforesaid act notwithstanding.\" And Whereas the said General Court on the seventeenth day of June in the aforesaid year of our Lord 1784 did nominate and appoint the aforesaid Samuel_Holten, and on the third day of November following the aforesaid Rufus_King Delegates to represent the said Commonwealth of Massachusetts in the Congress of the United_States of America for one year from the first monday of November in the said year 1784 which appointment remains in full force. \n\t\t\tNow therefore know ye, that we the said Samuel_Holten and Rufus_King by virtue of the power and authority to us committed by the said Acts of the General Court of Massachusetts before recited, in the name and for and on behalf of the said Commonwealth of Massachusetts, do by these presents assign transfer, quit claim, cede and convey to the United_States of America for their benefit Massachusetts inclusive, all right, title and estate, of and in as well the soil as the Jurisdiction which the said Commonwealth hath to the Territory or tract of Country within the limits of the Massachusetts Charter, situate and lying west of the following line. \n\t\t\tThat is to say a Meridian line to be drawn from the forty-fifth degree of North Latitude, through the westerly bent or inclination of Lake Ontario, thence by the said Meridian line to the most Southerly side line of the Territory contained in the Massachusetts Charter; but if on experiment the above described Meridian line shall not comprehend twenty miles due west from the most westerly bent or inclination of the River or Strait of Niagara, then we do by these presents by virtue of the power and authority aforesaid in the Name and on the behalf of the said Commonwealth of Massachusetts transfer quit claim, cede and convey to the United_States of America for their benefit Massachusetts inclusive, all right, title, and estate, of an[d] in, as well the soil as the Jurisdiction which the said Commonwealth hath to the Territory or tract of Country within the limits of the Massachusetts Charter, situate and lying west of the following line. That is to say, a Meridian line to be drawn from the 45th degree of North Latitude through a point twenty miles due West from the most westerly bent or inclination of the river or Strait of Niagara, thence by the said Meridian line to the most Southerly side line of the Territory contained in the Massachusetts Charter aforesaid,25 for the purposes in the said recited Acts declared, and to the uses in a Resolve of Congress of the tenth day of October 1780 mentioned.26 In testimony whereof we have hereunto subscribed our Names and affixed our Seals in Congress this Nineteenth day of April in the year of our Lord 1785 and of the Independence of the United_States of America the Ninth.-\n\t\t\tS. HOLTEN \n\t\t\tRufus_King \n\t\t\tSigned Sealed and delivered in the presence of Benjamin_Bankson Junr\n\t\t\tJohn_Fisher\n\t\t\tRobert Patton\n\t\t\t[Endorsed] Cession of western Territory by Massachusetts 19th April 1785 Recorded p. 13.27\n\t\t"